<?php
my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('data_setting', false);	
my_component_load('penyelenggara_pelatihan',false );
my_component_load('jadwal_pelatihan' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$modulname="Diklat _BN_ Planning _BN_ Development Selection" ;

if($_SERVER['REQUEST_METHOD'] == "POST" ):
	switch($task){
	case   "edit" :
		submit_jadwal_pelatihan($id);
		my_direct('index.php?com=jadwal_pelatihan');
		break; 
		case "create_penyelenggara_page":
			$validate = form_penyelenggara_pelatihan_validate(0);
			if($validate){
				$content = message_multi_error($validate);
				$content .= form_penyelenggara_pelatihan_create( 0);
				generate_my_web($content,"","plain.php");
				exit;
			}else{
				form_penyelenggara_pelatihan_submit(0);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}
		break;
	}

else: 	
	if($task == "edit"){
		$pagename= $modulname." _BN_ ";
		$pagename.= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
		load_facebox_script();
	 	$view  = form_jadwal_pelatihan($id);
	}elseif($task == 'delete'){ // DELETE ITEM	
		delete_jadwal($id);
		my_direct('index.php?com='.$_GET['com']);
	}elseif($task == "plaincetak"){
		@ob_end_clean(); 
		echo'<pre>';
		echo print_plain();
		exit;
	}elseif($task == "excel"){
		header("Content-Type: application/xls");
		header("Content-Disposition: attachment;filename=development_selection.xls");
		echo excel_report();
		exit;
	}elseif($task == "create_penyelenggara" ){
		$title= "Data penyelenggara";
		facebox_page('index.php?com='.$_GET['com'].'&task=create_penyelenggara_page'  , $title , 360	); 
	}elseif($task == "create_penyelenggara_page" ){
		$content  =  form_penyelenggara_pelatihan_create(); 
		generate_my_web($content,"","plain.php");
		exit;	
	}else{
		$pagename = $modulname;
		load_facebox_script();
		$view =  list_jadwal_pelatihan(); 
		
	}
endif;  

generate_my_web($view, $pagename );
?>